package itheima.com.Reader;

import java.io.*;

public class BufferedCopy02 {

    public static void main(String[] args) {

        String filePath = "D:\\一条小团团2\\2.jpg";
        String fliePath2 = "D:\\一条小团团\\xxx.jpg";
        BufferedInputStream bis = null;
        BufferedOutputStream bos = null;
        int bufLen = 0;
        byte[] bytes = new byte[1024];
        try {
            bis = new BufferedInputStream(new FileInputStream(filePath));
            bos = new BufferedOutputStream(new FileOutputStream(fliePath2));

            while ((bufLen = bis.read(bytes))!= -1){
                bos.write(bytes,0,bufLen);
                System.out.println("拷贝成功~~~~");
            }

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                bis.close();
                bos.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }


    }

}
